home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
CIncludes
/
CoachMarks.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-01
|
8KB
|
265 lines
/*
File: CoachMarks.h
Contains: Public CoachMark programming interface.
Version: Technology: Copland
Release: Universal Interfaces 3.0d3 on Copland DR1
Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
*/
#ifndef __COACHMARKS__
#define __COACHMARKS__
#ifndef __TYPES__
#include <Types.h>
#endif
#ifndef __SOUND__
#include <Sound.h>
#endif
#ifndef __WINDOWS__
#include <Windows.h>
#endif
#ifndef __HIWINDOWTYPES__
#include <HIWindowTypes.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
#if FOR_SYSTEM8_COOPERATIVE
/*
Macros ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
For X's, 2-bit groups specify the curvature of each leg
*/
#define XMarkTopLeftToBottomRight(curvature) (curvature)
#define XMarkTopRightToBottomLeft(curvature) (curvature << 2)
/*
Attributes ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
animation speeds
*/
enum {
kCoachMarkFastest = 0,
kCoachMarkSlowest = 31
};
/* sloppiness*/
enum {
kPerfectCoachMark = 0,
kSloppyCoachMark = 100
};
/* translucency*/
enum {
kMaxCoachMarkWeight = 100,
kDefaultCoachMarkRegularWeight = 75,
kDefaultCoachMarkHiddenWeight = 25
};
/* stroke width*/
enum {
kDefaultCircleCoachMarkThickness = 12,
kDefaultUnderlineCoachMarkThickness = 8,
kDefaultXCoachMarkThickness = 15,
kDefaultArrowCoachMarkThickness = 7,
kDefaultHighlighterCoachMarkThickness = 5
};
/* Selectors ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
enum {
kCircleCoachMark = 1,
kUnderlineCoachMark = 2,
kXCoachMark = 3,
kArrowCoachMark = 4,
kHighlighterCoachMark = 5,
kNumCoachMarkTypes = 5
};
typedef UInt32 CoachMarkType;
enum {
kCoachMarkStraight = 0,
kCoachMarkCurvesUp = 1,
kCoachMarkCurvesDown = 2
};
typedef UInt32 CoachMarkCurvature;
/*
Flags ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
theme element inheritance flags -- is "heritage" and "inherit" too wordy? Could use a scheme based on the word "trait"
*/
enum {
kCoachOverrideThemeNothing = 0,
kCoachOverrideThemeColor = (1 << 0),
kCoachOverrideThemeOpacity = (1 << 1),
kCoachOverrideThemeSloppiness = (1 << 2),
kCoachOverrideThemeStrokeWidth = (1 << 3),
kCoachOverrideAllThemeTraits = 0xFFFFFFFF
};
typedef UInt32 CoachThemeOverrideFlags;
enum {
kCoachMarkDefaultAnimation = 0
};
typedef UInt32 CoachAnimationType;
/*
In which direction should the animation go? For an arrow or underline
this is inherent in the geometry. For the others, some bit flags:
*/
enum {
kCoachMarkDefaultDirection = 0, /* for circle: */
kCoachMarkClockwise = 0x0000,
kCoachMarkCounterClockwise = 0x0001, /* X stroke direction: */
kCoachMarkTopLeftToBottomRightMask = 0x0000,
kCoachMarkBottomRightToTopLeftMask = 0x0004, /* X stroke direction: */
kCoachMarkTopRightToBottomLeftMask = 0x0000,
kCoachMarkBottomLeftToTopRightMask = 0x0008, /* which X stroke is first: */
kCoachMarkTopLeftToBottomRightFirstMask = 0x0000,
kCoachMarkTopRightToBottomLeftFirstMask = 0x0010
};
typedef UInt32 CoachDirection;
/* to specify how to erase a coach mark*/
enum {
kCoachMarkDefaultErase = 0
};
typedef UInt32 CoachMarkEraseOptions;
/*
Structures ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
opaque reference to a coach mark
*/
typedef struct OpaqueCoachMarkRef* CoachMarkRef;
/* CoachMarkRec specifies the appearance of a CoachMark*/
struct CoachMarkRec {
CoachMarkType markType; /* which shape of mark?*/
CoachThemeOverrideFlags themeOverrides; /* which values do we get from the theme? */
RGBColor color; /* what color shall the CoachMark be?*/
Handle sound; /* sound to be played upon drawing the coachmark (*** Doesn't work in D11)*/
UInt16 regularPercentage; /* 0..100 - opacity as drawn within the specified grafport*/
UInt16 hiddenPercentage; /* 0..100 - opacity as drawn outside the specified grafport*/
UInt16 sloppiness; /* 0..100*/
UInt16 thickness; /* in pixels*/
CoachMarkCurvature curvature; /* direction of bulge for line-like marks*/
};
typedef struct CoachMarkRec CoachMarkRec;
/* CoachMarkAnimation specifies the appearance of a coach mark's animation*/
struct CoachMarkAnimation {
CoachAnimationType effectType;
UInt32 speed;
CoachDirection direction;
};
typedef struct CoachMarkAnimation CoachMarkAnimation;
/*
The Freaky Good Stuff --------------------------------------------------------------------------------------------------------------------------------------------------------------
Creation/destruction
*/
extern OSStatus NewCoachMarkRef(const CoachMarkRec *appearance, CoachMarkRef *newCoachMark);
extern OSStatus GetNewCoachMarkRef(SInt16 resID, CoachMarkRef *newMark);
extern OSStatus DisposeCoachMark(CoachMarkRef theMark);
/* To specify geometry*/
extern OSStatus CoachRectOnWindow(CoachMarkRef mark, HIWindow *window, const Rect *localRect);
extern OSStatus CoachGlobalRect(CoachMarkRef mark, const Rect *globalRect);
extern OSStatus CoachStrokeOnWindow(CoachMarkRef theMark, HIWindow *window, const Point *localSource, const Point *localDest);
extern OSStatus CoachGlobalStroke(CoachMarkRef theMark, const Point *globalSource, const Point *globalDest);
/* Accessors*/
extern CoachMarkType GetCoachMarkType(CoachMarkRef theMark);
extern HIWindow *GetCoachMarkWindow(CoachMarkRef theMark);
extern OSStatus GetCoachMarkRect(CoachMarkRef mark, Rect *globalRect);
extern OSStatus GetCoachMarkStroke(CoachMarkRef theMark, Point *globalSource, Point *globalDest);
extern OSStatus SetCoachMarkColor(CoachMarkRef theMark, const RGBColor *color);
extern OSStatus GetCoachMarkColor(CoachMarkRef theMark, RGBColor *color);
extern OSStatus SetCoachMarkRegularWeight(CoachMarkRef theMark, UInt16 weight);
extern UInt16 GetCoachMarkRegularWeight(CoachMarkRef theMark);
extern OSStatus SetCoachMarkHiddenWeight(CoachMarkRef theMark, UInt16 weight);
extern UInt16 GetCoachMarkHiddenWeight(CoachMarkRef theMark);
extern OSStatus SetCoachMarkThickness(CoachMarkRef theMark, UInt16 thickness);
extern UInt16 GetCoachMarkThickness(CoachMarkRef theMark);
extern OSStatus SetCoachMarkSloppiness(CoachMarkRef theMark, UInt16 sloppiness);
extern UInt16 GetCoachMarkSloppiness(CoachMarkRef theMark);
extern OSStatus SetCoachMarkCurvature(CoachMarkRef theMark, CoachMarkCurvature curvature);
extern CoachMarkCurvature GetCoachMarkCurvature(CoachMarkRef theMark);
extern OSStatus SetCoachMarkThemeOverrides(CoachMarkRef theMark, CoachThemeOverrideFlags inHeritage);
extern OSStatus GetCoachMarkThemeOverrides(CoachMarkRef theMark, CoachThemeOverrideFlags *outHeritage);
/*
Drawing, animation, erasing
CoachMarkInteraction is synchronous and applies globallly, the other three are not and require windows
*/
extern OSStatus CoachMarkInteraction(CoachMarkRef theMark, const CoachMarkAnimation *effect);
extern OSStatus AnimateCoachMark(CoachMarkRef theMark, const CoachMarkAnimation *effect);
extern OSStatus DrawCoachMark(CoachMarkRef theMark);
extern OSStatus EraseCoachMark(CoachMarkRef theMark, CoachMarkEraseOptions options);
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import off
#endif
#ifdef __cplusplus
}
#endif
#endif /* __COACHMARKS__ */